package com.zyw.zhuangdian.util;

import org.springframework.util.Base64Utils;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.UUID;

public class Base64Util {
    public static String decode(String s){
        return new String(Base64Utils.decodeFromString(s));
    }
    public static String fullDecode(String s) throws UnsupportedEncodingException {
        return URLDecoder.decode(decode(s),"UTF-8");
    }
    public static String encode(String s){
        return Base64Utils.encodeToString(s.getBytes(StandardCharsets.UTF_8));
    }
    public static String newUUID(){
        return UUID.randomUUID().toString().replace("-","");
    }
}
